﻿
/* 
 * Since 2008 - 2012
 */
package com.hh.bss.talent.entity;

import javax.validation.constraints.NotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.hh.bss.base.BaseEntity;
import com.hh.bss.util.DateConvertUtils;



public class CvTag extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "CvTag";
	public static final String ALIAS_ID = "id";
	public static final String ALIAS_CV_ID = "cvId";
	public static final String ALIAS_TAG = "tag";
	public static final String ALIAS_COMMENT = "comment";
	public static final String ALIAS_CREATOR = "creator";
	public static final String ALIAS_CREATE_DT = "createDt";
	
	//date formats
	public static final String FORMAT_CREATE_DT = DATE_FORMAT;
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	
	private java.lang.Integer id;
	@NotNull 
	private java.lang.Integer cvId;
	@NotBlank @Length(max=30)
	private java.lang.String tag;
	@Length(max=255)
	private java.lang.String comment;
	@NotBlank @Length(max=50)
	private java.lang.String creator;
	@NotNull 
	private java.util.Date createDt;
	//columns END

	public CvTag(){
	}

	public CvTag(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setCvId(java.lang.Integer value) {
		this.cvId = value;
	}
	
	public java.lang.Integer getCvId() {
		return this.cvId;
	}
	public void setTag(java.lang.String value) {
		this.tag = value;
	}
	
	public java.lang.String getTag() {
		return this.tag;
	}
	public void setComment(java.lang.String value) {
		this.comment = value;
	}
	
	public java.lang.String getComment() {
		return this.comment;
	}
	public void setCreator(java.lang.String value) {
		this.creator = value;
	}
	
	public java.lang.String getCreator() {
		return this.creator;
	}
	public String getCreateDtString() {
		return DateConvertUtils.format(getCreateDt(), FORMAT_CREATE_DT);
	}
	public void setCreateDtString(String value) {
		setCreateDt(DateConvertUtils.parse(value, FORMAT_CREATE_DT,java.util.Date.class));
	}
	
	public void setCreateDt(java.util.Date value) {
		this.createDt = value;
	}
	
	public java.util.Date getCreateDt() {
		return this.createDt;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("CvId",getCvId())
			.append("Tag",getTag())
			.append("Comment",getComment())
			.append("Creator",getCreator())
			.append("CreateDt",getCreateDt())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof CvTag == false) return false;
		if(this == obj) return true;
		CvTag other = (CvTag)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

